/*
hmi_x5.h
offer hmi uart screen api extern and data type define


--------------------------
create file
2022-03-03 14:26:55
--------------------------
*/
#ifndef HMI_X5_
#define HMI_X5_

#ifdef __cplusepluse
extern "C"{
#endif

/*********************************date define**************************/


//recive data
typedef struct{
    int rec_flag;       //recive flag, 1=recived,0=nothing,send data will clear
    int rec_type;       //recive data type,0= normal msg,-1= err,0x70=get int data,0x71=get msg string
    int err_code;       //err_code
    int data;           //get cmd back recived data
    char msg[30];       //get cmd back recived msg string
}HMI_rec;

//hmi screen class
typedef struct{
    int init;       //init status,0=not init,1=inited
    int port;       //uart port
    int speed;      //uart baud speed
    void *uart;      //uart obj
    void (*rec_deal)(char *,int);       //custmer recice from hmi msg deal api
    char rec_task[20];      //rec task name
    HMI_rec rec;
}HMI;



/***********************************api extern*************************/
extern HMI *xp_hmi_init(int port,int speed,void (*rec_deal)(char *,int));    //init hmi on a uart port
extern int xp_hmi_deinit(HMI *hmi);     //deinit hmi object
extern int xp_hmi_send(HMI *hmi,char *msg);     //send cmd or msg to hmi screen
extern int xp_hmi_recDealAPI_regist(HMI *hmi,void (*rec_deal)(char*,int));      //regist recive deal api


extern HMI *xp_hmi_demo(int port,int speed);     //init a hmi screen demo


#ifdef __cplusepluse
}
#endif

#endif
//end of the file
